<ot-view>

    <div class="row">
        <div class="col-md-12">
            <div class="alert alert-info" ng-show="loadingStatus">
                <ot-loading>
                    Loading status...
                </ot-loading>
            </div>
        </div>
    </div>

    <div class="row" ng-hide="loadingStatus">
        <!-- Health -->
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ot-health-status value="status.health"></ot-health-status>
                    Health
                </div>
                <table class="table ot-admin-console-status">
                    <!-- Per section -->
                    <tbody ng-repeat="(sectionName, section) in status.health"
                           ng-if="sectionName != '_self' && sectionName != 'status'">
                    <!-- Section status -->
                    <tr class="active">
                        <td class="ot-health-status-span">
                            &nbsp;
                        </td>
                        <td>
                            <ot-health-status value="section"></ot-health-status>
                        </td>
                        <td colspan="5">
                            {{sectionName}}
                        </td>
                    </tr>
                    <!-- Section details -->
                    <tr ng-repeat="(configName, config) in section"
                        ng-if="configName != 'status'">
                        <td class="ot-health-status-span">
                            &nbsp;
                        </td>
                        <td class="ot-health-status-span">
                            &nbsp;
                        </td>
                        <td>
                            {{configName}}
                        </td>
                        <td>
                            <b>{{config}}</b>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="row">
        <!-- Connectors -->
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ot-health-status value="status.connectors"></ot-health-status>
                    Connectors
                    {{status.connectors.percent}}&nbsp;%
                    ({{status.connectors.upCount}}/{{status.connectors.count}})
                </div>
                <table class="table ot-admin-console-status">
                    <thead>
                    <tr>
                        <th>Type</th>
                        <th>Name</th>
                        <th>Connection</th>
                        <th>Status</th>
                        <th>Time</th>
                        <th>Error</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="collected in status.connectors.statuses">
                        <td>
                            {{collected.status.description.connector.type}}
                        </td>
                        <td>
                            {{collected.status.description.connector.name}}
                        </td>
                        <td>
                            {{collected.status.description.connection}}
                        </td>
                        <td>
                            <span class="fa fa-circle ot-health-status-{{collected.status.type}}">&nbsp;{{collected.status.type}}</span>
                        </td>
                        <td>
                            {{collected.time | date:'mediumDate' }}
                            {{collected.time | date:'shortTime' }}
                        </td>
                        <td>
                            {{collected.status.error}}
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</ot-view>